<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateYCategorysTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if(!Schema::hasTable('y_categorys')) {
            Schema::create('y_categorys', function (Blueprint $table) {
                $table->engine = 'MyISAM';
                $table->increments('category_id');
                $table->string('category_thumbnail')->default('')->comment('分组图标');
                $table->string('category_name', 20)->default('')->comment('组名');
                $table->smallInteger('category_type')->default(1)->comment('分类，1常规中，2专区..');
                $table->string('category_commit')->default('')->comment('备注');
                $table->boolean('category_status')->default(0)->comment('状态，1正常，2未开放');
                $table->timestamps();
                //索引
                $table->index('category_name');
                $table->index('category_type');
                $table->index('category_status');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('y_categorys');
    }
}
